<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/7/16
 * Time: 13:29
 */
namespace app\admin\validate;

use think\Validate;

class Provider extends Validate{
    protected $rule = [
        'name'      => 'require|max:50',
        'web'       => 'url|max:50',
        'linkman'   => 'max:20',
        'phone'     => ['regex'=>'/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/'],
        'address'   => 'max:50',
        'status'    => 'in:1,0',
    ];
    protected $message  =   [
        'name.require'      => '供应商名称不能为空',
        'web.url'           => 'web不正确',
        'name.max'          => '供应商名称不能超过50个字符',
        'web.max'           => 'web不能超过50个字符',
        'linkman.max'       => '联系人不能超过20个字符',
        'phone.regex'       => '号码不正确',
        'address.max'       => '地址不能超过50个字符',
        'status.in'         => '状态不正确',
    ];
}